package com.xhlj.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhlj.entity.PicUrls;
import com.xhlj.entity.WebhookPayload;
import com.xhlj.service.BlendService;
import com.xhlj.utils.Result;
import jakarta.annotation.Resource;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;

/**
 *
 *
 * @description 调用MidJourney接口实现多图融合、图片生成 接口网站：https://openapi.ai-gs.cn/user/index.html
 * @author Yzc
 * @create 2024/3/25
 **/

@RestController
@RequestMapping("mj")
public class MidjourneyController {
    @Resource
    private BlendService blendService;
    @PostMapping("blend")
    public Result blend(@RequestBody PicUrls picUrls){
        return blendService.blendByMj(picUrls);
    }
    @PostMapping("receive")
    public Result receive(@RequestBody WebhookPayload payload) {
        return blendService.receive(payload);
    }
}

